﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Dack_Web2
{
    public partial class DealByState : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                SanPham_Load();
            }
        }

        void SanPham_Load()
        {
            string t = Request.QueryString["stateID"].ToString();
            string str = "select * from SanPham, Deal where SanPham.MaSanPham = Deal.MaSanPham";
            if (t == "1")
                str = str + " and XacNhan=True";
            else
                str = str + " and XacNhan=False";
            DataTable dt = Sql_DataProvider.SQL_ExecuteTable(str);
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            SanPham_Load();
        }
    }
}